package ru.acme.lab12;

import ru.acme.lab12.domain.account.CheckingAccount;
import ru.acme.lab12.domain.bank.Bank;
import ru.acme.lab12.domain.client.ClientRegistrationListener;
import ru.acme.lab12.domain.account.Account;
import ru.acme.lab12.domain.account.SavingAccount;
import ru.acme.lab12.domain.client.Client;
import ru.acme.lab12.domain.client.Gender;
import ru.acme.lab12.service.bank.BankService;


public class BankApplication {
	
	public static void main(String[] argv) {
		Account account1 = new SavingAccount(1);
		Account account2 = new SavingAccount(1);
		System.out.println(account1 == account2);		//false
		System.out.println(account1.equals(account2));	//true
		Client client1 = new Client("E", Gender.MALE, new SavingAccount(1));
		client1.addAccount(new CheckingAccount(1, 1));
		Client client2 = new Client("E", Gender.MALE, new SavingAccount(1));
		System.out.println(client1.equals(client2));	//false
		client2.addAccount(new CheckingAccount(2, 1));
		client2.getAccounts().get(1).withdraw(1);
		System.out.println(client1.equals(client2));	//true

		
		Bank bank = new Bank(new ClientRegistrationListener[] {
				new Bank.EmailNotificationListener(), new Bank.PrintClientListener()});
			
		BankService.addClient(bank, new Client("A", Gender.MALE, new SavingAccount(30)));
		BankService.addClient(bank, new Client("B", Gender.MALE, new SavingAccount(30)));
		BankService.addClient(bank, new Client("C", Gender.FEMALE, new SavingAccount(30)));
		BankService.addClient(bank, new Client("D", Gender.FEMALE, new SavingAccount(30)));
		BankService.addClient(bank, new Client("F", Gender.MALE, new SavingAccount(30)));
		BankService.addClient(bank, new Client("G", Gender.MALE, new CheckingAccount(30, 20)));
		BankService.addClient(bank, new Client("H", Gender.FEMALE, new CheckingAccount(30, 20)));
		BankService.addClient(bank, new Client("I", Gender.FEMALE, new CheckingAccount(30, 20)));
		BankService.addClient(bank, new Client("J", Gender.MALE, new CheckingAccount(30, 20)));
		BankService.addClient(bank, new Client("K", Gender.MALE, new CheckingAccount(30, 20)));
		
		BankService.printBalances(bank);
		BankService.printMaximumAmountsToWithdraw(bank);
		BankService.modifyBank(bank);
		BankService.printBalances(bank);		
		BankService.printMaximumAmountsToWithdraw(bank);
		
	}

}
